<?php

namespace App\Http\Controllers;

use App\Library\Requests\Base\BasePageRequest;
use App\Library\Requests\Base\IdRequest;
use App\Library\Requests\UserMessage\UserMessageAddRequest;
use App\Library\Requests\UserMessage\UserMessageNewTimeRequest;
use App\Library\Requests\UserMessage\UserMessageReadRequest;
use App\Library\Service\UserMessageService;
use Illuminate\Http\JsonResponse;

class UserMessageController extends BaseController
{
    /**
     * @param UserMessageService $service
     */
    public function __construct(UserMessageService $service)
    {
        $this->service = $service;
    }

    /**
     * 分页
     * @param BasePageRequest $request
     * @return JsonResponse
     */
    public function paging(BasePageRequest $request): JsonResponse
    {
        return $this->service->paging($request);
    }

    /**
     * add
     * @param UserMessageAddRequest $request
     * @return JsonResponse
     */
    public function add(UserMessageAddRequest $request): JsonResponse
    {
        return $this->service->add($request);
    }

    /**
     * detail
     * @param IdRequest $request
     * @return JsonResponse
     */
    public function detail(IdRequest $request): JsonResponse
    {
        return $this->service->detail($request);
    }

    /**
     * delete
     * @param IdRequest $request
     * @return JsonResponse
     */
    public function delete(IdRequest $request): JsonResponse
    {
        return $this->service->delete($request);
    }

    /**
     * count
     * @return JsonResponse
     */
    public function count(): JsonResponse
    {
        return $this->service->count();
    }

    /**
     * read
     * @param UserMessageReadRequest $request
     * @return JsonResponse
     */
    public function read(UserMessageReadRequest $request): JsonResponse
    {
        return $this->service->read($request);
    }

    /**
     * newTime
     * @param UserMessageNewTimeRequest $request
     * @return JsonResponse
     */
    public function newTime(UserMessageNewTimeRequest $request): JsonResponse
    {
        return $this->service->newTime($request);
    }
}
